package io.lkt.modules.sys.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import io.lkt.common.utils.PageUtils;
import io.lkt.common.utils.Query;
import io.lkt.commons.dynamic.datasource.annotation.DataSource;
import io.lkt.modules.sys.dao.PageDetailLogDao;
import io.lkt.modules.sys.dao.PushHeadLogDao;
import io.lkt.modules.sys.entity.PageDetailLogEntity;
import io.lkt.modules.sys.entity.PushHeadLogEntity;
import io.lkt.modules.sys.service.PageDetailLogService;
import io.lkt.modules.sys.service.PushHeadLogService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;


@Service("PageDetailLogService")
public class PageDetailLogServiceImpl extends ServiceImpl<PageDetailLogDao, PageDetailLogEntity> implements PageDetailLogService {
    @Autowired
    PageDetailLogDao pageDetailLogDao;

    @Override
    @DataSource("logdb")
    public PageUtils queryPage(Map<String, Object> params) {
        IPage<PageDetailLogEntity> page = this.page(
                new Query<PageDetailLogEntity>().getPage(params),
                new QueryWrapper<PageDetailLogEntity>()
        );

        return new PageUtils(page);
    }

    @Override
    @DataSource("logdb")
    public List<PageDetailLogEntity> queryList(Map<String, Object> map) {
        return pageDetailLogDao.queryList(map);
    }

    @Override
//    @DataSource("logdb")
    public List<PageDetailLogEntity> queryMainList(Map<String, Object> map) {
        return pageDetailLogDao.queryMainList(map);
    }

    @Override
    @DataSource("logdb")
    public Integer queryTotal(Map<String, Object> map) {
        return pageDetailLogDao.queryTotal(map);
    }


}
